import request from "@/utils/request";
enum API{
    ALLMENU_URL = "/admin/acl/permission",

    //新增菜单的接口
    ADDMENU_URL = "/admin/acl/permission/save",

    //修改菜单的接口
    UPDATEMENU_URL = "/admin/acl/permission/update",
    
    //删除菜单的接口
    DELETEMENU_URL = "/admin/acl/permission/remove/"
}


export const reqAllMenu=()=>request.get<any,any>(API.ALLMENU_URL)

//新增和更新菜单的接口

export const reqAddOrUpdateMenu=(data:any)=>{
    if (data.id) {
      return  request.put<any,any>(API.UPDATEMENU_URL,data)
    }else{
        return  request.post<any,any>(API.ADDMENU_URL,data)
    }
}


//删除菜单的接口
export const reqDeleteMenu=(id:number)=>request.delete<any,any>(API.DELETEMENU_URL+`${id}`)

